#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>

int main()
{
    pid_t id=fork();
    int a=0;
    int test=1;
    if(id==-1)
    {
        perror("fork\n");
        return -1;
    }
    else if(id==0)
    {
        printf("%p ",&a);
        test=2;
        printf("test:%d &etst:%p\n",test,&test);
        printf("当前是子进程:pid:%d ppid:%d\n",getpid(),getppid());
        printf("\n");
    }
    else{

        printf("%p ",&a);
        test=1;
        printf("test:%d &test:%p\n",test,&test);
        printf("当前是父进程:pid:%d ppid:%d\n\n",getpid(),getppid());
    }

    printf("%d %p\n",id,&id);
    return 0;
}
